<?php
    include APPLICATION_PATH . '/application/views/head.phtml';
    include APPLICATION_PATH . '/application/views/top.phtml';
    include APPLICATION_PATH . '/application/views/left.phtml';
?>
<script src="<?=PUBLIC_PATH;?>public/js/jquery-1.10.1.min.js" type="text/javascript"></script>

 <script >

$(document).ready(function() {

	$('#submit_form').click(function() {
		var item_id = $(this).data("id");
		
		var __editForm = $('#form_edit');
		var objForm = {
			__formPwd: $("input[name='password']", __editForm),
			__formPassword: $("input[name='password1']", __editForm),
			__formPassword1: $("input[name='password2']", __editForm)
		}

		if (objForm.__formPassword.val() != objForm.__formPassword1.val()) {
			layer.alert('两次输入的密码不一致，请重新输入！');
			return false;
		}

		$.ajax({
			type: "POST",
			url: "/User/personInfo",
			data: {
				"user_id":item_id,
				"passwordOld": objForm.__formPwd.val(),
				"password": objForm.__formPassword.val()
			},
			success: function(data) {
                if(true === data.status){
                	layer.alert(data.info, function() {
                    window.location = "/User/login";
                    
                });
                }
                else{
                	layer.alert(data.info);
                }
				
			}
		});
		return false;
	});
})

 </script> 

<div id="thispage" data-id="91"></div>
		<!-- BEGIN PAGE -->

		<div class="page-content">

			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->

			<div id="portlet-config" class="modal hide">

				<div class="modal-header">

					<button data-dismiss="modal" class="close" type="button"></button>

					<h3>portlet Settings</h3>

				</div>

				<div class="modal-body">

					<p>Here will be a configuration form</p>

				</div>

			</div>

			<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->

			<!-- BEGIN PAGE CONTAINER-->        

			<div class="container-fluid">

				<!-- BEGIN PAGE HEADER-->

				<div class="row-fluid">

					<div class="span12">

						<!-- BEGIN STYLE CUSTOMIZER -->

						<div class="color-panel hidden-phone">

							<!-- <div class="color-mode-icons icon-color"></div> -->

							<div class="color-mode-icons icon-color-close"></div>

							<div class="color-mode">

								<p>THEME COLOR</p>

								<ul class="inline">

									<li class="color-black current color-default" data-style="default"></li>

									<li class="color-blue" data-style="blue"></li>

									<li class="color-brown" data-style="brown"></li>

									<li class="color-purple" data-style="purple"></li>

									<li class="color-grey" data-style="grey"></li>

									<li class="color-white color-light" data-style="light"></li>

								</ul>

								<label>

									<span>Layout</span>

									<select class="layout-option m-wrap small">

										<option value="fluid" selected>Fluid</option>

										<option value="boxed">Boxed</option>

									</select>

								</label>

								<label>

									<span>Header</span>

									<select class="header-option m-wrap small">

										<option value="fixed" selected>Fixed</option>

										<option value="default">Default</option>

									</select>

								</label>

								<label>

									<span>Sidebar</span>

									<select class="sidebar-option m-wrap small">

										<option value="fixed">Fixed</option>

										<option value="default" selected>Default</option>

									</select>

								</label>

								<label>

									<span>Footer</span>

									<select class="footer-option m-wrap small">

										<option value="fixed">Fixed</option>

										<option value="default" selected>Default</option>

									</select>

								</label>

							</div>

						</div>

						<!-- END BEGIN STYLE CUSTOMIZER -->  

						<!-- BEGIN PAGE TITLE & BREADCRUMB-->

						<h3 class="page-title">

							个人信息

						</h3>

						<ul class="breadcrumb">

							<li>

								<i class="icon-home"></i>
								<span>当前位置：</span>
								<span>首页</span>

								<i class="icon-angle-right"></i>

							</li>

							<li>

								<span>个人管理</span>

								<i class="icon-angle-right"></i>

							</li>

							<li><span>个人信息</span></li>

						</ul>

						<!-- END PAGE TITLE & BREADCRUMB-->

					</div>

				</div>

				<!-- END PAGE HEADER-->

				<!-- BEGIN PAGE CONTENT-->

				<div class="row-fluid">

					<div class="span6 responsive" data-tablet="span12 fix-offset" data-desktop="span6" style="width:100%;">

						<!-- BEGIN EXAMPLE TABLE PORTLET-->

						<div class="portlet box grey">

							<div class="portlet-title">

								<div class="caption"><i class="icon-user"></i>个人信息</div>

								<div class="actions controls">

								</div>

							</div>

							<div class="portlet-body">
							<form action="#" id="form_edit" method="post">

								<table width="500px" height="400px" style="margin:auto; text-align:center;">
									<thead>
									<?php
									foreach ($person as $key => $value) {
        echo <<< EOF
										<tr><th>用户名：</th><td><input type="text" disabled="disabled" class="colorpicker-default m-wrap" name="name" value="{$value['username']}" style="text-align:center;" ></td></tr>
                    					<tr><th>真实姓名：</th><td><input type="text" class="colorpicker-default m-wrap" name="name" value="{$value['realname']}" style="text-align:center;" id="username"></td></tr>
										<tr><th>原密码：</th><td><input name="password" type="password" value="" style="text-align:center;"/></td></tr>
										<tr><th>新密码：</th><td><input name="password1" type="password" value="" style="text-align:center;"></td></tr>
										<tr><th>确认密码：</th><td><input name="password2" type="password" value="" style="text-align:center;"></td></tr>
										<tr><td colspan='2'>
										<button class="btn green btn-primary" id="submit_form" data-dismiss="modal" data-id="{$value['user_id']}">提交</button></td>
EOF;
    }
    ?>
<!-- 	<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>		 -->						
                    
									</thead>
                </table>
		</form>




							</div>

						</div>
						
						
								


						<!-- END EXAMPLE TABLE PORTLET-->

					</div>

				</div>

				<!-- END PAGE CONTENT-->

			</div>

			<!-- END PAGE CONTAINER-->

		</div>

    <!-- END PAGE -->
<?php
    include APPLICATION_PATH . '/application/views/foot.phtml';
?>
